<%@ page language="java" isELIgnored="false" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html>
<%@ include file="/WEB-INF/jsp/ResourceGlobal.jsp"%>
<html>

<head>
<!-- 这里引入导航信息header.tpl -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>${todo.todoTypeName } ${todo.prjSname } <c:if test="${operType == 'fileDetail' }">详情</c:if><c:if test="${operType == 'fileUpload' }">材料上传</c:if><c:if test="${operType == 'fileConfirm' }">确认</c:if><c:if test="${operType == 'fileEnd' }">上传产出</c:if></title>
<script type="text/javascript">
	var fileType2Json = '';
	var operType = '${operType}';
	var fileType2JsonObj = {};
	<c:if test="${not empty fileType2Json}">
		fileType2JsonObj = ${fileType2Json};
	</c:if>
</script>
</head>

<body class="sub-page">
	<div class="container">
		<div class="page-content result-box">
			<form id="addForm" role="form" class="form-horizontal" method="post" action="<%=context%>business/myHome/todoAndOutput/save.do">
			<input type="hidden" id="id" name="id" value="${todo.id }"/>
			<input type="hidden" id="operType" name="operType" value="${operType }"/>
			<input type="hidden" id="confirmResult" name="confirmResult" value=""/>
			<input type="hidden" id="serviceType" value="${todo.serviceType }"/>
			<input type="hidden" id="todoType" value="${todo.todoType }"/>
			<div class="page-header">
				<h2 class="page-title"><c:if test="${operType == 'fileDetail' }">详情</c:if><c:if test="${operType == 'fileUpload' }">材料上传</c:if><c:if test="${operType == 'fileConfirm' }">确认</c:if><c:if test="${operType == 'fileEnd' }">上传产出</c:if></h2>
			</div>
			<div class="page-body model model-nohover">
				<div class="table-responsive">
					<table class="table table-bordered">
						<tbody>
							<tr>
								<td class="align-right gray-bg">管理人</td>
								<td class="align-left" colspan="3">${todo.companyName }</td>
							</tr>
							<tr>
								<td class="align-right gray-bg">服务类型</td>
								<td class="align-left" colspan="3">
									<wasp:dictConvertor dctRootType="SERVICE_TYPE" dctValue="${todo.serviceType }"/>
								</td>
							</tr>
							<tr>
								<td class="align-right gray-bg">待办类型</td>
								<td class="align-left" colspan="3">
									${todo.todoTypeName }
								</td>
							</tr>
							<tr>
								<td class="align-right gray-bg">待办日期</td>
								<td class="align-left" colspan="3">
									<fmt:formatDate value="${todo.todoDate }" pattern="yyyy-MM-dd"/>
								</td>
							</tr>
							<c:if test="${not empty todo.prjSname }">
								<tr>
									<td class="align-right gray-bg">产品简称</td>
									<td class="align-left" colspan="3">${todo.prjSname }</td>
								</tr>
								<tr>
									<td class="align-right gray-bg">产品代码</td>
									<td class="align-left" colspan="3">${todo.outerId }</td>
								</tr>
							</c:if>
							<tr>
								<td class="align-right gray-bg">无材料上传</td>
								<td class="align-left" colspan="3">
									${todo.noFile == 'Y' ? '是' : '否' }
									<input type="hidden" id="noFile" value="${todo.noFile }"/>
								</td>
							</tr>
							<tr>
								<td class="align-right gray-bg">审核/执行人员</td>
								<td class="align-left" colspan="3">
									${todo.postPersonnelNm }
								</td>
							</tr>
							<tr>
								<td class="align-right gray-bg">电话</td>
								<td class="align-left" colspan="3">
									${todo.empTelOff }
								</td>
							</tr>
						</tbody>
					</table>
				</div>
				
				<div id="uploadTips" class="uploadTips" style="display: none;">
					<p>需要上传的材料如下：</p>
					<span id="needUploadFileTyps">
						
					</span>
					
				</div>
			
				<div class="model-head">
					<span class="head-boder-left"></span>
					<h2>附件<input type="hidden" id="attachJson" name="attachJson"></h2>
				</div>
				<table class="table attachFileContainer" id="attachContainertodoAddView">
					<tbody>
						<c:if test="${operType == 'fileConfirm' or operType == 'fileEnd' or operType == 'fileDetail' }">
							<tr>
								<td colspan="1" style="border-top:0;font-weight:bolder;">
									附件列表<input id="attIdsInput" name="attIds" type="hidden">
								</td>
								<td colspan="5" class="tipsTd" style="border-top: 0;"></td>
							</tr>
						</c:if>
						<c:if test="${operType == 'fileUpload' }">
							<tr>
								<td colspan="1" style="border-top:0;font-weight:bolder;">
								        附件列表<input id="attIdsInput" name="attIds" type="hidden">
								</td>
								<td colspan="5" class="tipsTd" style="border-top: 0;">
									<span class="attachUploadWidget file-upload-file-name-area" style="color: red; line-height: 34px; display: inline;">温馨提醒：上传单个附件大小不能超过30M；对附件进行新增操作，都需要点击保存才能生效。</span>
								</td>
								<td class="attachUploadWidget" colspan="1" style="border-top: 0px; display: table-cell;">
									<button type="button" class="btn btn-primary pull-right" name="btnCopyProject" id="uploadBtnCustom">上传附件</button>
								</td>
							</tr>
						</c:if>
						<tr class="attachTitle"><td>附件名称</td><td>附件来源</td><td>材料类型</td><td>附件状态</td><td>上传人员</td><td>上传时间</td><c:if test="${operType == 'fileUpload' }"><td>操作列表</td></c:if></tr>
						<c:forEach var="dto" items="${attachs}">
	       					<tr id="${dto.attId}" class="uploaded">
	       						<input type="hidden" name="attId" value="${dto.attId}">
	       						<td>
	       							<a style="color:#000000;text-decoration:underline;" href="<%=context%>sys/attach/downloadAttach.do?attId=${dto.attId}" target='_blank'>${dto.attName}</a>
					            </td>
								<td>${dto.resourceSignName}</td>
		                    	<td>
					                <input type='hidden' name='fileTypeExtId${dto.attId}' id='fileTypeExtId${dto.attId}' value='${dto.extList[0].extId}'/>
		                    		<c:if test="${operType == 'fileUpload' }">
		                    			<select class="select2 fileTypeSelect" id="fileType${dto.attId}" data-init-value="${dto.extList[0].attrValue}">
		                    			</select>
		                    		</c:if>
		                    		<c:if test="${operType == 'fileConfirm' or operType == 'fileEnd' or operType == 'fileDetail' }">
		                    			<wasp:dictConvertor dctRootType="TODO_FILE_TYPE" dctFathType="${todo.serviceType }" dctLeftType="${todo.todoType }" dctValue="${dto.extList[0].attrValue}"></wasp:dictConvertor>
		                    		</c:if>
		                    	</td>
								<td>已上传</td>
								<td>${dto.createName}</td>
		                    	<td>${dto.createTime}</td>
		                    	<c:if test="${operType == 'fileUpload' }">
		                    		<td><a style="display:inline;" href="#" title="删除附件" class="btn btn-link btn-jqgrid f-delete" data-toggle="modal" data-target="#modal-info" name="attDelBtn">删除</a></td>
		                    	</c:if>
							</tr>
						</c:forEach>
					</tbody>
				</table>
				<c:if test="${operType == 'fileEnd' or operType == 'fileDetail'}">
					<div class="model-head">
						<span class="head-boder-left"></span>
						<h2>产出物</h2>
					</div>
					<input type="hidden" id="fileEndAttId" name="fileEndAttId">
					<jsp:include page="/WEB-INF/jsp/system/sys/attach/attachView.jsp">
						<jsp:param name="attachList" value="${fileEndAttachList}"/>
						<jsp:param name="resourceId" value=""/>
						<jsp:param name="module" value="todoFileEndView" />
						<jsp:param name="hasPermission" value="${attachPermission}" />
						<jsp:param name="resourceSign" value="${bizType }"/>
						<jsp:param name="hidAttIdField"  value="{{attId}}"/>
						<jsp:param name="hidAttNameField"  value="fileEndAttId"/>
					</jsp:include>
				</c:if>
				
					<div class="model-head">
						<span class="head-boder-left"></span>
						<h2>审批意见</h2>
					</div>
					<div>
						<jsp:include page="/WEB-INF/jsp/system/sys/opinion/opinionInfo.jsp"></jsp:include><!-- 操作日志 -->
					</div>
					<c:if test="${operType == 'fileConfirm' }">
						<div>
							<textarea rows="3" class="form-control" id="opinion" name="opinion"></textarea>
						</div>
					</c:if>
				
				
			</div>
			<div class="page-footer">
				<c:if test="${operType == 'fileUpload' }">
					<button type="button" class="btn btn-primary btn-save btn-loading btn-w-xs" data-loading-text="<i class='ico-loading'></i>" onclick="WASP_PRD_TEMPLATE.submitAddForm('S');">提交</button>
				</c:if>
				<c:if test="${operType == 'fileConfirm' }">
					<button type="button" class="btn btn-primary btn-save btn-loading btn-w-xs" data-loading-text="<i class='ico-loading'></i>" onclick="WASP_PRD_TEMPLATE.submitAddForm('C');">确认接收</button>
					<button type="button" class="btn btn-primary btn-save btn-loading btn-w-xs" data-loading-text="<i class='ico-loading'></i>" onclick="WASP_PRD_TEMPLATE.submitAddForm('R');">确认驳回</button>
				</c:if>
				<c:if test="${operType == 'fileEnd' }">
					<button type="button" class="btn btn-primary btn-save btn-loading btn-w-xs" data-loading-text="<i class='ico-loading'></i>" onclick="WASP_PRD_TEMPLATE.submitAddForm('E_TEMP');">保存产出附件</button>
					<button type="button" class="btn btn-primary btn-save btn-loading btn-w-xs" data-loading-text="<i class='ico-loading'></i>" onclick="WASP_PRD_TEMPLATE.submitAddForm('E');">完成产出上传</button>
				</c:if>
				<c:if test="${operType != 'fileDetail' }">
					<button type="button" class="btn btn-link btn-w-xs" onclick="window.close();">取消</button>
				</c:if>
			</div>
			
			</form>
		</div>
	</div>
	<script type="text/javascript" src="<%=context%>resources/modules/system/common/multi.upload.js?r=<%=Math.random()%>"></script>
	<script type="text/javascript" src="<%=context%>resources/modules/business/myHome/todoAndOutput/todoAdd.js?r=<%=Math.random()%>"></script>
</body>
</html>